//
//  WBHomeViewController.swift
//  Weibo_Swift_GX
//
//  Created by Tony on 2018/2/5.
//  Copyright © 2018年 Tony. All rights reserved.
//

import UIKit

class WBHomeViewController: WBBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    // MARK: -  Action
    
    @objc private func leftItemAction(sender: UIButton) {
//        print("leftItemAction \(sender)")
        
        let vc = DemoViewController()
        
        navigationController?.pushViewController(vc, animated: true)
    }
    
    /// test
    @objc func rightItemAction(sender: UIButton) {
        let vc = DemoViewController()
        
        navigationController?.pushViewController(vc, animated: true)
    }

    
    
    /// 设置界面
    override func setupUI() {
        super.setupUI()
        
        // 设置导航栏leftItem
        navItem.leftBarButtonItem = UIBarButtonItem(title: "Left", color: UIColor.blue, target: self, action: #selector(leftItemAction(sender:)))
        
        navItem.rightBarButtonItems = [UIBarButtonItem(title: "right", color: UIColor.blue, target: self, action: #selector(rightItemAction(sender:)))]
        
        
        
        // test
        
        let testC = WBTestControl(frame: CGRect(x: 0, y: 0, width: 200, height: 50))
        view.addSubview(testC)
        testC.center = view.center
        testC.backgroundColor = UIColor.red
        
        testC.addTarget(self, action: #selector(testCClick), for: .touchUpInside)
        
        
    }
    
    @objc func testCClick() {
        print("testCClick...")
    }
}





















